package com.c2soft.ncmxReport.service;

import org.jfree.data.time.Day;
import org.jfree.data.time.DynamicTimeSeriesCollection;
import org.jfree.data.time.Second;
import org.jfree.data.time.TimeSeries;
import org.jfree.data.time.TimeSeriesCollection;
import org.springframework.stereotype.Service;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.c2soft.ncmxReport.controller.ChartController;


@Service
public class ChartDataService {

	
	static final Logger logger = LogManager.getLogger(ChartController.class);
	
	/**
	 * Creates the time series data set.
	 * 
	 * @return the time series collection
	 */
	
   /* private static final int COUNT = 2 * 60;
    
	public DynamicTimeSeriesCollection createTimeSeriesDataSet() {
		logger.debug("Entering method createTimeSeriesDataSet for TimeSeries Data.");
		logger.debug("Creating data for TimeSeries Chart");
		final int COUNT = 2 * 60;
		final DynamicTimeSeriesCollection ds = new DynamicTimeSeriesCollection(2,this.COUNT,new Second());
        ds.setTimeBase(new Second(0, 0, 0, 1, 1, 2011));
		TimeSeries pop = new TimeSeries("Price", Day.class);
		/*pop.add(new Day(10, 1, 2004), 100);
		pop.add(new Day(10, 2, 2004), 150);
		pop.add(new Day(10, 3, 2004), 250);
		pop.add(new Day(10, 4, 2004), 275);
		pop.add(new Day(10, 5, 2004), 325);
		pop.add(new Day(10, 12, 2004), 425);	
		ds.addSeries(gaussianData(), 0, "Gaussian data1");
		ds.addSeries(gaussianData(), 0, "Gaussian data2");

		
		logger.debug("Data for TimeSeries Chart Created");
		logger.debug("Exiting method createTimeSeriesDataSet");
		return ds;*/
		
		
		public TimeSeriesCollection createTimeSeriesDataSet() {
			logger.debug("Entering method createTimeSeriesDataSet for TimeSeries Data.");
			logger.debug("Creating data for TimeSeries Chart");
			TimeSeriesCollection ds = new TimeSeriesCollection();
			TimeSeries pop = new TimeSeries("Population", Day.class);
			pop.add(new Day(10, 1, 2004), 100);
			pop.add(new Day(10, 2, 2004), 150);
			pop.add(new Day(10, 3, 2004), 250);
			pop.add(new Day(10, 4, 2004), 275);
			pop.add(new Day(10, 5, 2004), 325);
			pop.add(new Day(10, 12, 2004), 425);

			ds.addSeries(pop);
			logger.debug("Data for TimeSeries Chart Created");
			logger.debug("Exiting method createTimeSeriesDataSet");
			return ds;
	}
	
}
